<?=isset($header) ? $header : ''?>
<?php 

$role_array = array();

foreach($roles as $role){
	$role_array[$role->role_id] = $role->role_name;
}

?>
<div id="content">
	<div class="form_style">
		<div id="userinfo">
		<table>
			<tbody>
				<tr>
					<th style="display:none;">ID</th>
					<th>姓名</th>
					<th>ID</th>
					<th>權限</th>
					<th>E-Mail</th>
					<th>手機</th>
					<th>操作</th>
				</tr>
				<?
				foreach($users as $key=>$val){
				?>
				<tr>
					<td style="display:none;" ><?=$val->users_id?></td>
					<td><?=$val->name?></td>
					<td><?=$val->user?></td>
					<td><?php 
					if(!empty($role_array))
						echo $role_array[$val->role_id];
					?></td>
					<td><?=$val->email?></td>
					<td><?=$val->phone?></td>
					<td><a href="<?=site_url('/user/edit/'.$val->users_id)?>">[編輯]</a>&nbsp;<a href="<?=site_url('/user/delete/'.$val->users_id)?>">[刪除]</a></td>
				</tr>
				<?
				}
				?>
				<tr>
					<td colspan="5"><a href="<?=site_url('/user/add')?>" class="a_background">添加用戶</a></td>
				</tr>
			</tbody>
		</table>
		</div>
		<!-- nav1 end -->
	</div>
</div>
<?=isset($footer) ? $footer : ''?>